將AudioSource新增在一個空白GameObject上
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AudioControll : MonoBehaviour
{
public AudioClip BGM1;
AudioSource audioSource;
void Start()
{
audioSource = GetComponent<AudioSource>();
audioSource.PlayOneShot(BGM1);
}
}
待更
參考資料:
https://docs.unity3d.com/ScriptReference/AudioSource.html
https://www.youtube.com/watch?v=0XI-JLcwhR8